<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUser extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('user', function (Blueprint $table) {
            $table->integerIncrements('id');
            $table->unsignedInteger('cooperative_id')->default(0)->comment('合作商id');
            $table->string('nickname', 30)->default('')->comment('昵称');
            $table->string('phone', 20)->default('')->comment('手机号码');
            $table->string('password', 64)->default('')->comment('密码');
            $table->string('avatar', 128)->default('')->comment('用户头像');
            $table->unsignedTinyInteger('personal_certification')->default(0)->comment('个人认证：0未认证，1已认证');
            $table->unsignedTinyInteger('company_certification')->default(0)->comment('企业认证：0未认证，1已认证');
            $table->unsignedTinyInteger('level')->default(0)->comment('用户等级');
            $table->unsignedTinyInteger('credit_point')->default(0)->comment('信誉分');
            $table->unsignedInteger('commission')->default(0)->comment('佣金');
            $table->unsignedInteger('award')->default(0)->comment('平台奖励金');
            $table->unsignedTinyInteger('status')->default(0)->comment('状态：0禁用，1正常');
            $table->unsignedTinyInteger('is_employer')->default(0)->comment('悬赏主：0不是，1是');
            $table->string('alipay', 64)->default('')->comment('支付宝账号');
            $table->string('wx_mp_openid', 32)->default('')->comment('微信小程序openid');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user');
    }
}
